// export default {
// 	// 为当前模块开启命名空间
// 	namespaced: true,
// 	// 模块的 state 数据
// 	state: () => ({
// 		userInfo: JSON.parse(uni.getStorageSync('userInfo') || '{}'),
// 		uniToken: uni.getStorageSync('uniToken') || ''
// 	}),
// 	// 模块的 mutations 方法
// 	mutations: {
// 		//存储用户信息
// 		MugetUserInfo(state, payload) {
// 			state.userInfo = payload
// 			uni.setStorageSync('userInfo', JSON.stringify(state.userInfo))
// 		},
// 		MusetToken(state, payload) {
// 			state.uniToken = payload
// 			uni.setStorageSync('uniToken', state.uniToken)
// 		},
// 		MudelToken(state) {
// 			state.uniToken = ''
// 			uni.removeStorageSync('uniToken')
// 		}
// 	},
// 	// 模块的 getters 属性
// 	getters: {},
// }

export default {
	// 为当前模块开启命名空间
	namespaced: true,
	// 模块的 state 数据
	state: () => ({
		// 购物车数组，用来存储购物车中每个商品的信息
		ylToken: uni.getStorageSync('ylToken'),
		ylPhone: uni.getStorageSync('ylPhone'),
		ylUserId: uni.getStorageSync('ylUserId'),
		ylUserInfo: JSON.parse(uni.getStorageSync('ylUserInfo') || '{}'),
		ylEnterprise: JSON.parse(uni.getStorageSync('ylEnterprise') || '{}'),
		ylProjectCode: uni.getStorageSync('ylProjectCode'),
	}),
	// 模块的 mutations 方法
	mutations: {
		//存储用户信息
		MusetToken(state, payload) {
			state.ylToken = payload.accessToken
			state.ylPhone = payload.phone
			uni.setStorageSync('ylToken', state.ylToken)
			uni.setStorageSync('ylPhone', state.ylPhone)
		},
		MusetProjectCode(state, payload) {
			state.ylProjectCode = payload.projectCode
			uni.setStorageSync('ylProjectCode', state.ylProjectCode)
			uni.setStorageSync('ylProject', payload)
		},
		MusetUserId(state, payload) {
			state.ylUserId = payload
			uni.setStorageSync('ylUserId', state.ylUserId)
		},
		MusetUserInfo(state, payload) {
			state.ylUserInfo = payload
			uni.setStorageSync('ylUserInfo', JSON.stringify(state.ylUserInfo))
		},
		MusetEnterprise(state, payload) {
			state.ylEnterprise = payload
			// state.ylEnterprise.enterpriseCode = '220230609120636A002' //测试
			// state.ylEnterprise.enterpriseCode = '220230517055022A007' //测试
			uni.setStorageSync('ylEnterprise', JSON.stringify(state.ylEnterprise))
			uni.setStorageSync('changeEnterprise', true)
		},
		MudelToken(state) {
			state.ylToken = ''
			state.ylPhone = ''
			state.ylUserId = ''
			state.ylUserInfo = {}
			uni.setStorageSync('changeEnterprise', true)
			uni.removeStorageSync('ylToken')
			uni.removeStorageSync('ylPhone')
			uni.removeStorageSync('ylUserId')
			uni.removeStorageSync('ylUserInfo')
		},
	},
	// 模块的 getters 属性
	getters: {},
}

